/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package notificacoes;

import java.sql.*;

/**
 *
 * @author fernando
 */
public class Conexao {

    static Connection conexao = null;

        public Connection Acesso() {
        if (conexao == null) {
            try {
                Class.forName("org.postgresql.Driver");
                conexao =
                        DriverManager.getConnection("jdbc:postgresql://localhost:5432/notifier_db", "notifier", "notifier");
            } catch (SQLException e) {
                System.err.println("Erro: " + e);
                conexao = null;
            } catch (ClassNotFoundException e) {
                System.out.println("ClassNotFound...");
                e.printStackTrace();
            }
        }
        return conexao;
    }
}
